<!DOCTYPE html>
<html>

<head>
    <title>我在易经应用直播（${(course.title)!""}）</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0"/>
    <link rel="stylesheet" href="/resources/asl/yijing/lib/weui.min.css">
    <link rel="stylesheet" href="/resources/asl/yijing/lib/jquery-weui.css">
    <style>
        body {
            background: #f1f1f1;
            font-size: 14px;
        }

        .bar {
            text-align: center;
            padding: 10px;
            font-size: 16px;
        }

        .cover {
            background: url("${course.imageURL}") center center no-repeat;
            height: 200px;
            background-size: 100% auto;
            background-position: top;
            border-top: 1px solid #dadada;
            border-bottom: 1px solid #dadada;
        }

        .title {
            text-align: center;
            font-size: 14px;
            border-bottom: 10px solid #ebebeb;
            padding-bottom: 10px;
        }

        .title p {
            line-height: 30px;
            height: 30px;
            font-size: 14px;
        }

        .title .n {
            line-height: 40px;
            height: 35px;
        }

        .title .avator {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            vertical-align: middle;
            margin-right: 10px;
        }

        .handle {
            text-align: center;
            padding: 10px;
            border-bottom: 10px solid #ebebeb;
        }

        .handle .time {
            font-size: 18px;
            color: #6e6e6e;
            line-height: 40px;
        }

        .handle .baoming {
            width: 100px;
            font-size: 14px;
            color: #ffffff;
            background: #ffa62e;
        }

        .handle .baoming:hover {
            color: #ffffff;
            background: #ffa62e;
        }

        .handle .count {
            font-size: 12px;
            padding-top: 10px;
            color: #7a7a7a;
        }

        .description {
            padding: 10px 0;
        }

        .description .t {
            text-align: left;
            color: #ffa62e;
            padding-left: 10px;
        }

        .description .content {
            padding: 10px;
        }

        .download {
            font-size: 12px;
            height: 44px;
            background: #000000;
            color: #ffffff;
            padding: 5px;
        }

        .download .open {
            color: #ffffff;
            background: #009500;
            font-size: 12px;
            border-radius: 3px;
            padding: 5px 8px;
            float: right;
            margin: 10px 5px;
            line-height: 14px;
        }

        .download img {
            float: left;
            width: 35px;
            height: 35px;
            margin: 5px;
        }

        .download div.t {
            float: left;
            line-height: 15px;
            padding-top: 8px;
        }

    </style>
</head>
<body>
<div class="download">
    <img src="/resources/asl/images/app_logo.png"/>
    <div class="t">
        <p>易经应用</p>
        <p>立即下载APP成为老师开始主播</p>
    </div>
    <a class="open" href="${download_url}">打开APP</a>
</div>
<div style="clear: both"></div>
<div class="bar">${(course.title)!""}</div>
<div class="cover"></div>
<div class="title">
    <p class="n">${course.title}</p>
    <p>
        <img class="avator" src="${(course.member.avator)!""}"/>
        老师 : ${(course.member.name)!""}
    </p>
</div>
<div class="handle">
[#-- 预告 --]
[#if course.type == "trailer"]
    <p>距离开播时间还有</p>
    <p class="time" id="show">-</p>
    [#if apply==true]
        <p><a href="javascript:;" class="weui_btn weui_btn_primary to-app baoming">已报名</a></p>
    [#else ]
        <p><a href="javascript:;" class="weui_btn weui_btn_primary to-app baoming">报名</a></p>
    [/#if]
    <p class="count">报名人数 ${course.applyCount} 人</p>
[#else]

    [#if course.courseType == "nolive"][#-- 未直播 --]

    [#elseif course.courseType == "live"][#-- 直播中 --]
        <p><a href="[#if course.charge||course.encrypt]
        ${download_url}[#else]/weChat/live/contentSDK.htm?id=${course.live.id}[/#if]" class="weui_btn weui_btn_primary to-app baoming">观看</a></p>
        <p class="count">观看人数 ${(course.live.watchCount)!"0"} 人</p>
    [#elseif course.courseType == "finished"][#-- 录播 --]

        <p>
        [#if course.live.mp4URL??]
            [#list course.live.mp4URL?split('!!') as mp4]
            <a href="javascript:void(0)" onclick="
                [#if course.charge||course.encrypt]
                        jump_down('${download_url}')
                [#else]
                        jump('video.htm?url=${mp4}')
                [/#if]" class="weui_btn weui_btn_primary to-app baoming">观看录播${mp4_index+1}</a>
            [/#list]
        [/#if]
        </p>
        <p class="count">观看人数 ${(course.live.hisWatchCount)!"0"} 人</p>
    [/#if]

[/#if]
</div>
<div class="description">
    <p class="t">简介</p>
    <div class="content">${(course.introduction)!""}</div>
</div>
<script src="/resources/asl/yijing/lib/jquery-2.1.4.js"></script>
<script src="/resources/asl/yijing/lib/jquery-weui.min.js"></script>
<script>
    // 距离时间
    function count_down(o) {
        var datatime = /^[\d]{4}-[\d]{1,2}-[\d]{1,2}( [\d]{1,2}:[\d]{1,2}(:[\d]{1,2})?)?$/ig, str = '', conn, s;
        if (!o.match(datatime)) {
            return false;
        }
        var sec = (new Date(o.replace(/-/ig, '/')).getTime() - new Date().getTime()) / 1000;
        s = {' 天 ': sec / 24 / 3600, ' 小时 ': sec / 3600 % 24, ' 分 ': sec / 60 % 60, ' 秒 ': sec % 60};
        for (i in s) {
            if (Math.floor(s[i]) > 0) str += Math.floor(s[i]) + i;
        }
        if (Math.floor(sec) == 0) {
            str = '0 秒';
        }
        if (str == '') {
            str = '-'
        }
        document.getElementById('show').innerHTML = str;
        setTimeout(function () {
            count_down(o)
        }, 1000);
    }
    [#if course.type == "trailer"]
    count_down('${course.datePattern?string("yyyy-MM-dd HH:mm:ss")}');
    [/#if]

    function jump(url){
        $.showLoading("正在加载...");
        location.href= url ;
    }

    function jump_down(url){
        $.alert("该视频为付费视频，请下载APP进行","", function() {
            $.showLoading("正在加载...");
            location.href= url ;
        });

    }

</script>
</body>

</html>